<?php
function lilina_userapi_get($args)
{
    extract($args);
    if (empty($id) || !is_numeric($id)) {
        $msg = xarML('Invalid Parameter');
        xarErrorSet(XAR_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException($msg));
        return;
    }
    if(!xarSecurityCheck('OverviewLilina')) return;
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();
    $table = $xartable['feeds'];
    $query = "SELECT xar_id,
                     xar_url
            FROM $table
            WHERE xar_id = ?";
    $bindvars = array($id);
    $result =& $dbconn->Execute($query,$bindvars);
    if (!$result) return;
    list($id, $url) = $result->fields;
    $result->Close();
    $link = array('id'      => $id,
                  'url'     => $url);
    // Get categories (if any)
    if (xarModIsHooked('categories','lilina')) {
        $cids = xarModAPIFunc('categories','user','getlinks',
                              array('iids' => array($id),
                                    //'itemtype' => 0, // not needed here
                                    'modid' => xarModGetIDFromName('lilina'),
                                    'reverse' => 1));
        if (isset($cids[$id]) && is_array($cids[$id])) {
            $link['cids'] = $cids[$id];
            $link['catid'] = join('+',$cids[$id]);
        }
    }
    return $link;
}
?>